<template>
  <div class="small_card el-card is-always-shadow">
    <div class="small_card_top">
      <div class="small_card_top_left">
        <img :src="img" alt="" srcset="">
        <div class="quan" :class="line?'on_line':'off_line'"></div>
      </div>
      <div class="small_card_top_right">
        <div :style="line?'color:#000000':'color:#FE294D'">{{title}}</div>
        <span>{{subheading}}</span>
        <span>{{subhead}}</span>
        <span v-if="operation">运行天数：{{operation}}</span>
      </div>
    </div>
    <div class="small_card_bottom" :class="'small_card_bottom_'+buttons" v-if="type">
      <div @click="viewHeld" v-if="['institution','medicalcare','department'].includes(type)">
        <img src="../../assets/iconfont/particulars.png" alt="">
        <span>详情</span>
      </div>
      <div @click="editHeld" v-if="['institution','medicalcare','administrativeedit','department'].includes(type)">
        <img src="../../assets/iconfont/edit.png" alt="">
        <span>编辑</span>
      </div>
      <div @click="editHeld" v-if="['statistical'].includes(type)">
        <img src="../../assets/iconfont/edit.png" alt="">
        <span>编辑权限</span>
      </div>
      <div @click="familyHeld" v-if="['institution'].includes(type)">
        <img src="../../assets/iconfont/family.png" alt="">
        <span>科室管理</span>
      </div>
      <div @click="medicHeld" v-if="['administrativeedit'].includes(type)">
        <img src="../../assets/iconfont/family.png" alt="">
        <span>医护管理</span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name:"smallCard",
    props:{
      line:{
        type:Boolean,
        default:false
      },
      subhead:{
        type:String,
      },
      subheading:{
        type:String
      },
      operation:{
        type:String
      },
      title:{
        type:String,
      },
      buttons:{
        type:String
      },
      type:{
        type:String
      },
      img:{
      }
    },
    data() {
      return {

      }
    },
    mounted() {
    },
    methods:{
      //机构
      viewHeld(){
        this.$emit('clickHeld','viewHeld')
      },
      editHeld(){
        this.$emit('clickHeld','editHeld')
      },
      familyHeld(){
        this.$emit('clickHeld','familyHeld')
      },
      //科室
      // administrativeedit(){
      //   this.$emit('clickHeld','administrativeedit')
      // },
      //医护
      medicHeld(){
        this.$emit('clickHeld','medicHeld')
      },
      medicviewHeld(){
        this.$emit('clickHeld','medicviewHeld')
      },
      mediceditHeld(){
        this.$emit('clickHeld','mediceditHeld')
      },
    }
  }
</script>

<style lang="scss" scoped>
  .small_card{
    margin: 15px;
    display: inline-block;
    padding: 12px;
    width: 343px;
    max-height: 193px;
  }
  .small_card_top{
    // border-bottom: 1px solid #EBEBEB;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 17px 14px;
  }
  .small_card_top_left{
    position: relative;
    width: 80px;
    height: 80px;
    img{
      width: 100%;
      height: 100%;
      border-radius: 50%;
    overflow: hidden;
    }
    .quan{
      position: absolute;
      bottom: 0;
      right: 0;
      border: 2px solid #FFFFFF;
      width: 20px;
      height: 20px;
      border-radius: 100%;
    }
  }
  .on_line{
    background-color: #19CDA6;
  }
  .off_line{
    background-color: #FE294D;
  }
  .small_card_top_right{
    height: 80px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    margin-left: 17px;
    div{
      font-size: 16px;
      font-weight: 400;
    }
    span{
      font-size: 14px;
      font-weight: 400;
      color: #989898;
    }
  }
  .small_card_bottom{
    display: flex;
    align-items: center;
    padding: 12px;
    border-top: 1px solid #EBEBEB;
    div{
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      img{
        width: 21px;
        height: 21px;
        margin-right: 4px;
      }
      span{
        font-size: 16px;
        font-weight: 400;
        color: #0584FE;
      }
    }
    div:active{
      opacity: .6;
    }
  }
  .small_card_bottom_1{
    justify-content: flex-end;
  }
  .small_card_bottom_2{
    justify-content: space-between;
  }
</style>
